﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<ObjectModel.customers>>" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">

        
<ext:GridPanel runat="server" ID="grd" Height="400" Frame="true" AutoExpandColumn="name" Layout="FitLayout"
    Title="Index" >
    <Store>
        <ext:Store runat="server" >
			<Proxy>
				<ext:HttpProxy Url="/Customers/GetCustomers/" />
			</Proxy>
            <Reader>
                <ext:JsonReader IDProperty="id">
                    <Fields>
			<ext:RecordField Name="id" />
				<ext:RecordField Name="name" />
				<ext:RecordField Name="corporate_name" />
				<ext:RecordField Name="creation_date" />
				<ext:RecordField Name="client_type" />
				<ext:RecordField Name="description" />
				<ext:RecordField Name="cnpj" />
				<ext:RecordField Name="municipal_registration" />
				<ext:RecordField Name="state_registration" />
				<ext:RecordField Name="tel" />
				<ext:RecordField Name="cel" />
				<ext:RecordField Name="personal_email" />
				<ext:RecordField Name="business_email" />
				<ext:RecordField Name="fax" />
				<ext:RecordField Name="street" />
				<ext:RecordField Name="complement" />
				<ext:RecordField Name="cep" />
				<ext:RecordField Name="neighbourhood" />
				<ext:RecordField Name="city" />
				<ext:RecordField Name="state" />
				<ext:RecordField Name="active" />
				<ext:RecordField Name="removed" />
	                    </Fields>
                </ext:JsonReader>
            </Reader>
        </ext:Store>
    </Store>
	
	<TopBar>
        <ext:Toolbar ID="Toolbar" runat="server">
			<Items>
				<ext:Button runat="server" ID="btnNovo" OnClientClick="window.location = 'customers/Create';" Text="Novo">
				</ext:Button>
			</Items>
        </ext:Toolbar>
	</TopBar>

	<ColumnModel runat="server">
        <Columns>
            <ext:Column DataIndex="name" Header="name" />
	            <ext:Column DataIndex="corporate_name" Header="corporate_name" />
	            <ext:Column DataIndex="client_type" Header="client_type" />
	            <ext:Column DataIndex="description" Header="description" />
	<ext:CommandColumn Width="80">
    <Commands>
        <ext:GridCommand Icon="ArrowDown">
            <Menu EnableScrolling="false">
                <Items>
					<ext:MenuCommand Text="Editar" Icon="ArrowRight" CommandName="Edit" />
					<ext:MenuCommand Text="Detalhes" Icon="ArrowRight" CommandName="Details" />
					<ext:MenuCommand Text="Excluir" Icon="ArrowRight" CommandName="Delete" />
                </Items>
            </Menu>
            <ToolTip Text="Menu" />
        </ext:GridCommand>
    </Commands>
</ext:CommandColumn>
		</Columns>
    </ColumnModel>
    <SelectionModel>
        <ext:RowSelectionModel runat="server" />
    </SelectionModel>
    <Listeners>
        <Command Handler="window.location = 'customers/'+command+'/'+record.data.id"/>
    </Listeners>
    <BottomBar>
        <ext:PagingToolbar ID="PagingToolbar" runat="server" PageSize="10">
        </ext:PagingToolbar>
    </BottomBar>
</ext:GridPanel>




</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="HeaderContent" runat="server">
</asp:Content>

